From: kfraser@localhost.localdomain Date: Wed, 2 Aug 2006 08:38:08 +0000 (+0100) Subject: [HVM][VMX] Clean up vmx hvm interface functions: X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15754^2~17 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=8b7270326c6ef21d50193597baf01890765997db;p=xen.git [HVM][VMX] Clean up vmx hvm interface functions: 1) define vmx hvm interface functions static. 2) setup hvm interface functions only once. Signed-off-by: Xin Li --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index f8df7bbcf8..66991e0a0e 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -477,7 +477,7 @@ static void vmx_ctxt_switch_to(struct vcpu *v) vmx_restore_dr(v); } -void stop_vmx(void) +static void stop_vmx(void) { if (read_cr4() & X86_CR4_VMXE) __vmxoff(); @@ -562,7 +562,7 @@ static void fixup_vm86_seg_bases(struct cpu_user_regs *regs) BUG_ON(err); } -void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) +static void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) { vmx_vmcs_enter(v); @@ -588,7 +588,7 @@ void vmx_load_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs) vmx_vmcs_exit(v); } -int vmx_realmode(struct vcpu *v) +static int vmx_realmode(struct vcpu *v) { unsigned long rflags; @@ -596,7 +596,7 @@ int vmx_realmode(struct vcpu *v) return rflags & X86_EFLAGS_VM; } -int vmx_instruction_length(struct vcpu *v) +static int vmx_instruction_length(struct vcpu *v) { unsigned long inst_len; @@ -605,7 +605,7 @@ int vmx_instruction_length(struct vcpu *v) return inst_len; } -unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num) +static unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num) { switch ( num ) { @@ -622,7 +622,7 @@ unsigned long vmx_get_ctrl_reg(struct vcpu *v, unsigned int num) } /* SMP VMX guest support */ -void vmx_init_ap_context(struct vcpu_guest_context *ctxt, +static void vmx_init_ap_context(struct vcpu_guest_context *ctxt, int vcpuid, int trampoline_vector) { int i; @@ -669,6 +669,28 @@ static int check_vmx_controls(u32 ctrls, u32 msr) return 1; } +/* Setup HVM interfaces */ +static void vmx_setup_hvm_funcs(void) +{ + if ( hvm_enabled ) + return; + + hvm_funcs.disable = stop_vmx; + + hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources; + hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources; + + hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs; + hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs; + + hvm_funcs.realmode = vmx_realmode; + hvm_funcs.paging_enabled = vmx_paging_enabled; + hvm_funcs.instruction_length = vmx_instruction_length; + hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg; + + hvm_funcs.init_ap_context = vmx_init_ap_context; +} + static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page) { char *p; @@ -755,21 +777,7 @@ int start_vmx(void) vmx_save_init_msrs(); - /* Setup HVM interfaces */ - hvm_funcs.disable = stop_vmx; - - hvm_funcs.initialize_guest_resources = vmx_initialize_guest_resources; - hvm_funcs.relinquish_guest_resources = vmx_relinquish_guest_resources; - - hvm_funcs.store_cpu_guest_regs = vmx_store_cpu_guest_regs; - hvm_funcs.load_cpu_guest_regs = vmx_load_cpu_guest_regs; - - hvm_funcs.realmode = vmx_realmode; - hvm_funcs.paging_enabled = vmx_paging_enabled; - hvm_funcs.instruction_length = vmx_instruction_length; - hvm_funcs.get_guest_ctrl_reg = vmx_get_ctrl_reg; - - hvm_funcs.init_ap_context = vmx_init_ap_context; + vmx_setup_hvm_funcs(); hvm_funcs.init_hypercall_page = vmx_init_hypercall_page; diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 2b14b7c420..2886f51b6d 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -25,7 +25,6 @@ #include extern int start_vmx(void); -extern void stop_vmx(void); extern void vmcs_dump_vcpu(void); extern void vmx_init_vmcs_config(void);